import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PickupProductVO, PickupProductForm, PickupProductQuery } from '@/api/purchase/pickup/types';

/**
 * 查询提货列表
 * @param query
 * @returns {*}
 */

export const listPickupProduct = (query?: PickupProductQuery): AxiosPromise<PickupProductVO[]> => {
  return request({
    url: '/oa/pickupProduct/page',
    method: 'get',
    params: query
  });
};

/**
 * 查询提货详细
 * @param pickupProductId
 */
export const getPickupProduct = (pickupProductId: string | number): AxiosPromise<PickupProductVO> => {
  return request({
    url: '/oa/pickupProduct/' + pickupProductId,
    method: 'get'
  });
};

/**
 * 新增提货
 * @param data
 */
export const addPickupProduct = (data: PickupProductForm) => {
  return request({
    url: '/oa/pickupProduct/add',
    method: 'post',
    data: data
  });
};

/**
 * 修改提货
 * @param data
 */
export const updatePickupProduct = (data: PickupProductForm) => {
  return request({
    url: '/oa/pickupProduct/edit',
    method: 'put',
    data: data
  });
};

/**
 * 删除提货
 * @param pickupProductId
 */
export const delPickupProduct = (pickupProductId: string | number | Array<string | number>) => {
  return request({
    url: '/oa/pickupProduct/' + pickupProductId,
    method: 'delete'
  });
};
